@extends('layout.layoutv5')
@section('content')
    <div class="row">
        <div class="col-sm-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h1>今日销量</h1>
                </div>
                <div class="ibox-content text-success">
                    <h2 class="no-margins"><small>销售额（元）：</small>{{ $todayCountInfo['sale_price_sum'] }}</h2>
                    <h2 class="no-margins"><small>销售量（件）：</small>{{ $todayCountInfo['count'] }}</h2>
                    <h2 class="no-margins"><small>净利润（元）：</small>{{ $todayCountInfo['profit_sum'] }}</h2>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h1>昨日销量</h1>
                </div>
                <div class="ibox-content text-info">
                    <h2 class="no-margins"><small>销售额（元）：</small>{{ $yesterdayCountInfo['sale_price_sum'] }}</h2>
                    <h2 class="no-margins"><small>销售量（件）：</small>{{ $yesterdayCountInfo['count'] }}</h2>
                    <h2 class="no-margins"><small>净利润（元）：</small>{{ $yesterdayCountInfo['profit_sum'] }}</h2>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h1>本月累计</h1>
                </div>
                <div class="ibox-content text-navy">
                    <h2 class="no-margins"><small>销售额（元）：</small>{{ $toMonthCountInfo['sale_price_sum'] }}</h2>
                    <h2 class="no-margins"><small>销售量（件）：</small>{{ $toMonthCountInfo['count'] }}</h2>
                    <h2 class="no-margins"><small>净利润（元）：</small>{{ $toMonthCountInfo['profit_sum'] }}</h2>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <h5>{{--统计图--}}</h5>
                <div class="pull-right">
                    <div class="btn-group">
                        <button type="button" class="btn btn-xs btn-white active">天</button>
                        <button type="button" class="btn btn-xs btn-white">月</button>
                        <button type="button" class="btn btn-xs btn-white">年</button>
                    </div>
                </div>
                <div class="echarts" id="echarts-line-chart"></div>
            </div>
        </div>
    </div>
@endsection
@section('js_block')
    <script src="/js/plugins/echarts/echarts-all.js"></script>


    <script>
        $(document).ready(function () {
            var lineChart = echarts.init(document.getElementById("echarts-line-chart"));
            var lineoption = {
                title : {
                    text: ''
                },
                tooltip : {
                    trigger: 'axis'
                },
                legend: {
                    data:['销售额','销量','净利润']
                },
                grid:{
                    x:40,
                    x2:40,
                    y2:24
                },
                calculable : true,
                xAxis : [
                    {
                        type : 'category',
                        boundaryGap : false,
                        //data : ['周一','周二','周三','周四','周五','周六','周日']
                        data : {!! json_encode($dateList) !!}
                    }
                ],
                yAxis : [
                    {
                        type : 'value',
                        /* axisLabel : {
                         formatter: '{value} °C'
                         }*/
                    }
                ],
                series : [
                    {
                        name:'销售额',
                        type:'line',
                        data:{!! json_encode($salePriceSum) !!}
                    },
                    {
                        name:'销量',
                        type:'line',
                        data:{!! json_encode($countList) !!}
                    },
                    {
                        name:'净利润',
                        type:'line',
                        data:{!! json_encode($profitSum) !!}
                    }
                ]
            };
            lineChart.setOption(lineoption);

            $(window).resize(lineChart.resize);
        });
    </script>
@endsection
